inspector: Disable autoloaded custom css initially
authorMatthias Clasen <mclasen@redhat.com>
Sat, 6 Apr 2019 23:08:10 +0000 (23:08 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 6 Apr 2019 23:08:10 +0000 (23:08 +0000)
This is a safeguard against possible crashing css
being autoloaded.

gtk/inspector/css-editor.c

index 630f27f36f58d56c39e8f210641260f913cb85bd..d8d11efa9e854b7d8ae9649f68695721dbe13210 100644 (file)
@@ -119,8 +119,9 @@ set_initial_text (GtkInspectorCssEditor *ce)
 
   autosave_file = get_autosave_path ();
 
-  g_file_get_contents (autosave_file, &initial_text, &len, NULL);
-  if (!initial_text)
+  if (g_file_get_contents (autosave_file, &initial_text, &len, NULL))
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ce->priv->disable_button), TRUE);
+  else
     initial_text = g_strconcat ("/*\n",
                                 _("You can type here any CSS rule recognized by GTK."), "\n",
                                 _("You can temporarily disable this custom CSS by clicking on the “Pause” button above."), "\n\n",